home *** CD-ROM | disk | FTP | other *** search
- Path: news.one.net!news
- From: api@axiom.access.one.net (Adam Ierymenko)
- Newsgroups: comp.lang.c
- Subject: Unix/C question
- Date: 7 Apr 1996 05:48:31 GMT
- Organization: OneNet Communications HUB News Server
- Message-ID: <4k7kvf$gf4@news.one.net>
- NNTP-Posting-Host: axiom.access.one.net
- X-Newsreader: knews 0.9.5
-
- I have two questions regarding C under a Unix (Posix actually) environment:
-
- 1) The manual page of the send() function call does not clearly say what the
- call does when you attempt to send on a non-blocking inet socket and there
- is "room" to send on the socket for some, but not all, of your data.
- Like if you try to send 2048 bytes on a socket where there is room to send
- 1024 bytes, does send() send the first 1024 and return the number of bytes
- it actually sent (1024), or does it just return -1 and EWOULDBLOCK?
-
- 2) Is it considered good programming practice to malloc() memory for small
- structures one-at-a-time, such as for an expanding linked list? Would it
- be better to allocate in large chunks somehow? Does allocating small
- "atomic" pieces of memory waste lots of memory under Unix-type platforms
- the way it does under DOS?
-
- BTW, my OS is Linux, but I am trying to write something portable. Please
- reply by mail since I usually don't read this group.
-
-
-